<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use App\Http\Controllers\IndexController;
use App\Http\Controllers\CategoryController;
use App\Http\Controllers\ArchiveController;
use App\Http\Controllers\ReportController;
use App\Http\Controllers\FileController;
use App\Http\Controllers\TagController;

Route::get('/', [IndexController::class, 'index'])->name('index');

Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
    return view('dashboard');
})->name('dashboard');

Route::get('/bizhi', [CategoryController::class, 'bizhi'])->name('bizhi.index');
Route::get('/touxiang', [CategoryController::class, 'touxiang'])->name('touxiang.index');
Route::get('/meitu', [CategoryController::class, 'meitu'])->name('meitu.index');
Route::get('random_file/{file}', [FileController::class, 'file'])->name('random_file');

Route::get('bizhi/{archive}', [ArchiveController::class, 'show'])->name('bizhi.show');
Route::get('touxiang/{archive}', [ArchiveController::class, 'show'])->name('touxiang.show');
Route::get('meitu/{archive}', [ArchiveController::class, 'show'])->name('meitu.show');

Route::post('report', [ReportController::class, 'store'])->name('report.store');
Route::get('archives/{archive}/edit', [ArchiveController::class, 'edit'])->name('archives.edit');
Route::get('archives/create/{category:id?}', [ArchiveController::class, 'create'])->name('archives.create');
Route::post('archives', [ArchiveController::class, 'store'])->name('archives.store');
Route::post('upload/{archive?}', [FileController::class, 'upload'])->where('archive', '[0-9]+')->name('files.upload');
Route::delete('files/{file}', [FileController::class, 'destroy'])->where('file', '[0-9]+')->name('files.destroy');
Route::get('tags/{category}/{tag:slug}', [TagController::class, 'index'])->name('tags.index');
Route::get('svg/{file}', [FileController::class, 'test']);
